﻿Public Class CarFastEditor
    Dim pOldKmValue As Integer

    Dim CarObject As L3DObjectsLibrary.Car
    Private Property OldKmValue As Integer
        Get
            Return pOldKmValue
        End Get
        Set(ByVal value As Integer)
            pOldKmValue = value
        End Set
    End Property
    Public Sub Reset()
        Car.kmStatus = OldKmValue
    End Sub
    Public Property Car As L3DObjectsLibrary.Car
        Get
            Return CarObject
        End Get
        Set(ByVal value As L3DObjectsLibrary.Car)
            CarObject = value
            numKm.Value = value.kmStatus
            lblCarName.Text = Car.Name
        End Set
    End Property
    Private Sub cmdKmIncrement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd1000.Click, cmd100.Click, cmd10.Click, cmd1.Click
        Dim Increment As Integer
        If sender Is cmd1000 Then
            Increment = 1000
        ElseIf sender Is cmd100 Then
            Increment = 100
        ElseIf sender Is cmd10 Then
            Increment = 10
        ElseIf sender Is cmd1 Then
            Increment = 1
        End If
        numKm.Value = numKm.Value + Increment
    End Sub

    Private Sub numKm_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numKm.ValueChanged
        If sender Is numKm Then
            CarObject.kmStatus = numKm.Value
        End If

    End Sub

    Private Sub CarFastEditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        OldKmValue = Car.kmStatus
    End Sub
End Class
